package cn.tedu.car.backend.vehicleCombo.controller;

import cn.tedu.car.backend.base.response.JsonResult;
import cn.tedu.car.backend.vehicle.pojo.dto.VehicleSaveParam;
import cn.tedu.car.backend.vehicleCombo.pojo.dto.VehicleComboPrarm;
import cn.tedu.car.backend.vehicleCombo.pojo.dto.VehicleComboQuery;
import cn.tedu.car.backend.vehicleCombo.pojo.vo.VehicleComboVO;
import cn.tedu.car.backend.vehicleCombo.service.VehicleComboService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/v1/combo")

public class VehicleComboController {
    @Autowired
    VehicleComboService vehicleComboService;
    @GetMapping("select")
    public JsonResult selectVehicleCombo(VehicleComboQuery vehicleComboQuery){
        log.debug("查询车辆套餐Combo={}",vehicleComboQuery);
        List<VehicleComboVO> list= vehicleComboService.selectVehicleCombo(vehicleComboQuery);
        return JsonResult.ok(list);
    }
    @PostMapping("save")
    public JsonResult saveVehicle(VehicleComboPrarm vehicleComboPrarm){
        log.debug("新增套餐信息，vehicleComboPrarm={}",vehicleComboPrarm);
        vehicleComboService.saveVehicle(vehicleComboPrarm);
        return JsonResult.ok();
    }
    @PostMapping("delete/{id}")
    public JsonResult deleteVehicle(@PathVariable Long id){
        log.debug("删除车套餐信息，id={}", id);
        vehicleComboService.deleteVehicleCombo(id);
        return JsonResult.ok();
    }
}
